<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>求学生平均成绩</title>
</head>
<body>
    <script>
        var num = prompt('请输入班级总人数');
        var average = 0;
        var sum = 0;
        for (var i = 0; i < num; i++) {
            var score = prompt('请输入第' + (i + 1) + '个学生成绩');
            sum = sum + Number(score);
        }
        average = sum / num;
        alert('班级总成绩是' + sum);
        alert('班级平均成绩是' + average);
    </script>
</body>
</html>